package com.taxshare.manager.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.taxshare.manager.service.SupplierInfoService;
import com.taxshare.manager.view.vo.SupplierInfoVO;
import com.taxshare.mybatis.pager.PageRequest;
import com.taxshare.response.beans.Response;

/**
 * @ClassName: SupplierInfoController
 * @Description:
 * @author: luozhongyi
 * @date: 2021/1/14 11:30
 */
@RestController
@RequestMapping(value = "/supplier")
@Api(tags = "供应商")
public class SupplierInfoController {

	@Autowired
    private SupplierInfoService supplierInfoService;

    @ApiOperation(value = "供应商录入", notes = "供应商录入")
    @PostMapping("/save")
    public Response saveSupplier(@RequestBody SupplierInfoVO reqVO) {
        return supplierInfoService.saveSupplier(reqVO);
    }

    @ApiOperation(value = "供应商列表分页", notes = "供应商列表分页")
    @PostMapping("/queryPageList")
    public Response<IPage<SupplierInfoVO>> queryPageList(@RequestBody PageRequest<SupplierInfoVO> reqVO) {
        return supplierInfoService.queryPageList(reqVO);
    }
    
    @ApiOperation(value = "更新供应商信息", notes = "更新供应商信息")
    @PostMapping("/update")
    public Response udpateSupplier(@RequestBody SupplierInfoVO reqVO) {
        return supplierInfoService.udpateSupplier(reqVO);
    }

    @ApiOperation(value = "删除供应商信息", notes = "删除供应商信息")
    @PostMapping("/delete")
    public Response deleteSupplier(@RequestParam String uuid) {
        return supplierInfoService.deleteSupplier(uuid);
    }

    @RequestMapping(method = RequestMethod.POST, value = "/list")
    @ApiOperation(notes = "供应商下拉列表", value = "供应商下拉列表")
    public Response<List<SupplierInfoVO>> queryList() {
        return supplierInfoService.queryList();
    }
}
